<script setup lang="ts">
import { ref } from "vue";

import { useMouseStore } from "@/stores/mouse";
import { useSearchStore } from "@/stores/search";

const mouseStore = useMouseStore();
const offset = ref(0);

const searchStore = useSearchStore();

const mockSetSearch = () => {
  searchStore.setSearch("userList", {
    name: "张三",
    age: 18,
    sex: "男",
    job: "前端",
  });
};

const mockGetSearch = () => {
  console.log(searchStore.getSearch("userList"));
};
</script>

<template>
  <div>光标位置：{{ mouseStore.mouse.x }}---{{ mouseStore.mouse.y }}</div>
  <input type="string" v-model="offset" />
  <button @click="mouseStore.setOffset(+offset)">设置偏移值</button>
  <div>
    偏移后位置：{{ mouseStore.offsetPosition.x }}---{{
      mouseStore.offsetPosition.y
    }}
  </div>
  $pinia.state：{{ $pinia.state }}
  <button @click="mockSetSearch">设置搜索条件</button>
  <button @click="mockGetSearch">获取搜索条件</button>
</template>

<style scoped></style>
